#include "mypushbutton.h"
#include <QDebug>

//MyPushButton::MyPushButton(QWidget *parent) : QPushButton(parent)
//{

//}

MyPushButton::MyPushButton(QString normalImage, QString pressedImage)
{
    this->m_normalImage = normalImage;
    this->m_pressedImage = pressedImage;

    //使用QPixmap加载图片
    QPixmap pix;
    bool ret = pix.load(this->m_normalImage);
    if(!ret){
        qDebug() << "图片加载失败:" << m_normalImage;
        return;
    }
    //设置按钮大小
    this->setFixedSize(pix.width(), pix.height());

    //设置不规则图片样式
    this->setStyleSheet("QPushButton{border: 0px;}");

    //设置图标
    this->setIcon(pix);

    //设置图标大小
    this->setIconSize(QSize(pix.width(), pix.height()));

}
